<?php  
namespace Home\Controller;
use Think\Controller;
class PassController extends Controller {   
    public function index(){
   		 $this->display();
	}

	public function checkdata(){
		$id = $_SESSION['id'];
		$pass = I('post.pass');
		$repass = I('post.repass');

		if($pass == $repass){
			$data['password'] = md5($pass);
			if(M('user')->where("id=$id")->save($data)){
				$arr=array(
	   				'error'=>0,
	   				'info'=>'密码成功',
	   				
	   			);
	   			echo json_encode($arr);
	   			exit;
			}else{
				$arr=array(
	   				'error'=>1,
	   				'info'=>'密码修改不成功',
	   				
	   			);
	   			echo json_encode($arr);
	   			exit;
			}

		}else{
			$arr=array(
   				'error'=>1,
   				'info'=>'密码不一致',
   				
   			);
   			echo json_encode($arr);
   			exit;
		}
	}


}


?>